﻿using SUNRPA.CONTROLS.IMPL.util;
using System.Collections.Concurrent;
/// <summary>
/// Excel有Office和Wps目前只支持Office后期加入Wps支持。
/// </summary>
namespace SUNRPA.CONTROLS.IMPL.domain.flowItemParam {
    [Serializable]
    public class WriteToExcelNParam:BaseParam {
        private string writeObjectName = "{excelObject}";
        //内容为一串字符串或者一个列表变量名称，若为字符串则是填充，若为列表则循环填充
        private string writeContent = "";
        //写入范围0列，1行，2单元格
        private int range = 0;
        //写入方式0追加，1插入，2覆盖
        private int writeWay = 0;
        private string row = "";
        private string column = "";
        private string sheetName = "";
        public int Range {
            get => range; 
            set { 
                range = value;
                NotifyPropertyChanged("Range");
            }  
        }
        public int WriteWay {
            get => writeWay; 
            set { 
                writeWay = value;
                NotifyPropertyChanged("WriteWay");
            }  
        }
        public string WriteObjectName {
            get => writeObjectName; 
            set { 
                writeObjectName = value;
                NotifyPropertyChanged("WriteObjectName");
            }  
        }
        public string WriteContent {
            get => writeContent; 
            set { 
                writeContent = value;
                NotifyPropertyChanged("WriteContent");
            }  
        }
        public string Row {
            get => row; 
            set { 
                row = value;
                NotifyPropertyChanged("Row");
            }  
        }
        public string Column {
            get => column; 
            set { 
                column = value;
                NotifyPropertyChanged("Columns");
            }
}
        public string SheetName {
            get => sheetName; 
            set { 
                sheetName = value;
                NotifyPropertyChanged("SheetName");
            }  
        }
        public string GetTranslateRange() {
            switch(this.range) {
                case 0:
                    return "列";
                case 1:
                    return "行";
                case 2:
                    return "单元格";
                default : return "列";
            }
        }

        public string GetTranslateWriteWay() {
            switch(this.writeWay) {
                case 0:
                    return "追加";
                case 1:
                    return "插入";
                case 2:
                    return "覆盖";
                default : return "追加";
            }
        }

        public string GetTranslateItemInfo() {
            string ww = GetTranslateWriteWay();
            switch(this.range) {
                case 0:
                    return "在第"+column+"上"+ww+"一列，从第"+row+"行开始";
                case 1:
                    return ww+"一行，从第"+column+"列开始";
                case 2:
                    return "在（第" + row + "行，第" + column + "列）的单元格内";
                default : return "";
            }
        }
    }
}
